Co-pending U.S. patent application Ser. No. 12/847,925 entitled “ASSUMPTION-BASED OPTIMIZATION,” filed Jul. 30, 2010, the entire contents of which are hereby incorporated by reference for all purposes, discloses optimizing a compiled code based an assumption, for example, and testing at runtime to ensure, prior to executing the optimized code, whether the assumption is true. Such a technique may be used, for example, to create a more efficient compiled version of software code written in a dynamic and flexible scripting and/or other programming language, such as JavaScript®.
A characteristic of dynamic languages, such as JavaScript®, is that certain attributes cannot be determined conclusively in advance to have a particular value. For example, the variable type of a variable typically cannot be guaranteed to be of a predetermined type. Similarly, at runtime a target (e.g., location of code corresponding to) a called function may have changed. As another example, the code comprising an operation may change. As such, typically at least certain techniques commonly used to generate optimized compiled versions of less dynamic code, such as statically typed code, have not be available to be used to optimize compiled versions of code written in a dynamic language such as JavaScript®.